package random.fox.p2p.ui;

import android.content.Context;
import android.support.v7.widget.Toolbar;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import android.widget.TextView;

import butterknife.ButterKnife;
import butterknife.InjectView;
import de.greenrobot.event.EventBus;
import random.fox.p2p.R;
import random.fox.p2p.event.ActionBarEvent;
import random.fox.p2p.ui.customview.TagSpan;

/**
 * 粉丝布局
 * Created by wq on 15/3/22.
 */
public class FansView extends LinearLayout {
    @InjectView(R.id.toolbar)Toolbar toolbar;
    @InjectView(R.id.fans_tags)TextView fansTags;

    public FansView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        ButterKnife.inject(this);
        toolbar.setTitle("我的粉丝");
        EventBus.getDefault().post(new ActionBarEvent(toolbar,-1,true));

        //TODO 放到这里只是测试效果
        SpannableStringBuilder builder = new SpannableStringBuilder("逗比  齐天大剩");
        builder.setSpan(new TagSpan(getContext(),"逗比"),0,2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        builder.setSpan(new TagSpan(getContext(),"齐天大剩"),4,8, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        fansTags.setText(builder);
    }
}
